package com.sbp.message.api.entity;

import java.io.Serializable;

public enum LocalRecordType implements Serializable {
    LocalRecordType_producer(0),    // 生产者
    LocalRecordType_consumer(1);    // 消费者
    protected static final LocalRecordType defaultEnum = LocalRecordType_producer;

    protected final int value;
    private LocalRecordType(int value) {
        this.value = value;
    }

    public int getValue() {
        return this.value;
    }
    public static int getValue(LocalRecordType status) {
        if (status == null)
            return defaultEnum.value;
        else
            return status.value;
    }
    public static LocalRecordType valueOf(int value, boolean returnDefault) {
        LocalRecordType[] list = LocalRecordType.values();
        for (int i=0; i<list.length; ++i) {
            if (list[i].value == value)
                return list[i];
        }

        if (returnDefault)
            return defaultEnum;
        else
            return null;
    }
}
